package com.biz.primus.ms.stock.dao.po;

import com.biz.primus.common.enums.StockChannelEnum;
import com.biz.primus.model.stock.enums.StockChangeTypeEnum;
import com.biz.primus.model.stock.vo.IncrDepotStockReqVo;
import com.biz.primus.ms.base.jpa.po.BaseEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;

/**
 * StockChange
 *
 * @author JKLiues
 * @date 2017年10月21日
 */
@Getter
@Setter
@Entity
@Table(name = "stock_change_log")
@NoArgsConstructor
public class StockChangeLog extends BaseEntity {

    private static final long serialVersionUID = 8053349998477560076L;
    /**
     * 业务单据号
     */
    private String bn;

    /**
     * 门店编码
     */
    private String depotCode;

    /**
     * 商品编码
     */
    private String productCode;

    /**
     * 数量
     */
    private Integer quantity;
    /**
     * 剩余可用库存
     */
    private Integer remain;

    /**
     * 渠道码
     */
    @Enumerated(EnumType.STRING)
    private StockChannelEnum channelCode;
    /**
     * 库存变更类型
     */
    @Enumerated(EnumType.STRING)
    private StockChangeTypeEnum changeType;

    public StockChangeLog(IncrDepotStockReqVo reqVo) {
        this.bn = reqVo.getBn();
        this.depotCode = reqVo.getDepotCode();
        this.changeType = reqVo.getChangeType();
        this.channelCode = reqVo.getChannelCode();
    }
}